#!/bin/bash
script_path=$(realpath "${BASH_SOURCE[0]}")
script_dir=$(dirname "$script_path")

${script_dir}/step0-customize.sh

# change below first before run
CLUSTER_TOKEN=u6byzx.jvaz6q73nnkvn687
CLUSTER_HASH=sha256:89637231ea0e9b0b0588a3fe80242c9aeb39ec865855d023c3a7b188f7b45352

sudo kubeadm join ${MASTER_IP}:6443 \
  --token ${CLUSTER_TOKEN} \
  --discovery-token-ca-cert-hash ${CLUSTER_HASH} \
  --cri-socket=unix:///var/run/containerd/containerd.sock

mkdir -p $HOME/.kube
cp -i /etc/kubernetes/kubelet.conf ~/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
kubectl get pods -n kube-system